import request from '@/utils/request'

//登录
export function login(data) {
  return request({
    url: '/admin/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-admin-template/user/info',
    method: 'get',
    params: { token }
  })
}

//读取配置
export function getSettings(params) {
  return request({
    url: '/admin/getSettings',
    method: 'get',
    params
  })
}

//更新配置
export function saveSettings(data) {
  return request({
    url: '/admin/saveSettings',
    method: 'post',
    data
  })
}

//登出
export function logout() {
  return request({
    url: '/admin/logout',
    method: 'delete'
  })
}

//获取客服列表
export function getCustomerServices(params) {
  return request({
    url: '/admin/getCustomerServices',
    method: 'get',
    params
  })
}

//添加客服
export function addCustomerService(data) {
  return request({
    url: '/admin/addCustomerService',
    method: 'post',
    data
  })
}

//编辑客服
export function updateCustomerService(data) {
  return request({
    url: '/admin/updateCustomerService',
    method: 'post',
    data
  })
}

//删除客服
export function deleteCustomerService(data) {
  return request({
    url: '/admin/deleteCustomerService',
    method: 'delete',
    data
  })
}

//修改客服启用/禁用，状态
export function abandonCustomerService(data) {
  return request({
    url: '/admin/abandonCustomerService',
    method: 'post',
    data
  })
}

//上传文件
export function uploadConfigFile(data) {
  return request({
    url: '/admin/uploadFile',
    method: 'post',
    data
  })
}

//删除配置文件
export function deleteConfigFile(data) {
  return request({
    url: '/admin/deleteFile',
    method: 'delete',
    data
  })
}

//修改密码
export function updateAdminUserPassword(data) {
  return request({
    url: '/admin/updatePassword',
    method: 'post',
    data
  })
}